package com.tensquare.article.dao;

import com.tensquare.article.pojo.Article;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

public interface ArticleDao extends JpaRepository<Article,String>, JpaSpecificationExecutor<Article> {
    //审核文章
    @Query(nativeQuery=true,value="update tb_article set state='1' where id=?1")
    @Modifying
    void examine(String id);
    //文章点赞
    @Query(nativeQuery=true,value="update tb_article set thumbup=thumbup+1 where id=?1")
    @Modifying
    void thumbup(String articleId);
}
